function fixCodeView(doc) {
    const elements = doc.querySelectorAll('[data-code-language]');
    elements.forEach((item) => {
        item.style.overflow = "auto";
        item.querySelectorAll('[data-slate-type="pre"]').forEach((c) => {
            console.log("find pre");
            c.style.width = "fit-content";
        });
        item.querySelectorAll('.ps__rail-x').forEach((c) => {
            c.remove();
        });
        item.querySelectorAll('.ps__rail-y').forEach((c) => {
            c.remove();
        });
    });
}

function copyAvailable(doc) {
    const elements = doc.querySelectorAll('*');
    console.log(elements.length)
    for (let i = 0; i < elements.length; i++) {
        elements[i].style.userSelect = 'text';
    }
}

function forward(link, type) {
    link = '/single?fileType=' + type + '&link=' + encodeURIComponent(link.replaceAll("\\", "/"));
    window.open(link, '_blank');
}

function addOnloadListener(callback) {
    const originalOnLoad = window.onload;

    window.onload = function() {
        if (typeof originalOnLoad === 'function') {
            originalOnLoad(); // 执行原有的 onload 函数
        }
        // 确保我的逻辑在最后执行
        callback();
    };
}